package web2023.team.homework_10_aop.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import web2023.team.homework_10_aop.dao.UserDao;
import web2023.team.homework_10_aop.entity.User;

@Service
public class UserServiceImpl implements UserService {

    //private UserDao userDao = new UserDaoImpl();
    @Autowired
    private UserDao userDao;

    @Override
    public boolean userLogin(User user) {
        User sqlUser = userDao.userLogin(user);
        if(sqlUser == null){
            return false;
        }else{
            if((sqlUser.getUserName().equals(user.getUserName())) && (sqlUser.getPassword().equals( user.getPassword()))) return true;
            return false;
        }
    }

}
